<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:o="http://openfaces.org/"
      xmlns:comp="http://facelets.mycomponents.com">
<h:head>
    <title>ScrumApp</title>
    <link type="text/css" rel="stylesheet" href="resources/css/style.css" />
    <link type="text/css" rel="stylesheet" href="resources/css/theme.css"/>
    <link type="text/css" rel="stylesheet" href="resources/css/primefacesSkin.css"/>
    <script type="JavaScript" src="scripts/handleDialogComplete.js"></script>
		<script type="text/javascript">
			function handleDrop(event, ui) {
				//ui.draggable.fadeOut(function() {jQuery(this).fadeIn();});

				//jQuery(this).droppable('disable');
			}
		</script>
</h:head>

<h:body>
    <f:view locale="#{Language.locale}">
        <f:loadBundle basename="resources.messages.Messages" var="msgBundle"/>
        <div id="container">
            <div id="header">
                <h2>ScrumApp</h2>
                <div id="topmenu">
                    <ul>
                        <li><a href="/ScrumApp/faces/Project.xhtml">#{msgBundle.project}</a></li>
                        <li><a href="/ScrumApp/faces/ProductBacklog.xhtml">#{msgBundle.product_backlog}</a></li>
                        <li><a href="/ScrumApp/faces/SprintBacklog.xhtml">#{msgBundle.sprint_backlog}</a></li>
                        <li><a href="/ScrumApp/faces/SprintList.xhtml">#{msgBundle.sprint_list}</a></li>
                        <li><a href="/ScrumApp/faces/Impediments.xhtml">#{msgBundle.impediments}</a></li>
                        <li><a href="/ScrumApp/faces/People.xhtml">#{msgBundle.people}</a></li>
                        <li><a href="/ScrumApp/faces/Charts.xhtml">#{msgBundle.charts}</a></li>
                        <li class="current"><a href="/ScrumApp/faces/Taskboard.xhtml">#{msgBundle.taskboard}</a></li>
                    </ul>
                </div>
            </div>
            <div id="top-panel">
                <comp:chooseProject id="chooseProject" />
            </div>
        </div>

        <div id="kanbancontainer">
            <div id="kanbancontent">
                <h:form id="projectForm" prependId="false" styleClass="form" >

                    <div class="extendedbox" align="center" >
                        <h3>
                            <h:outputText value="Task Board" />
                        </h3>

                        <div class="kanbanbox" align="center" >
                            <h3>
                                <h:outputText value="#{msgBundle.pending}" />
                            </h3>

                            <p:outputPanel id="todoPanel" styleClass="bigslot">
                                <p:droppable dropListener="#{taskboardBean.onDrop}"
                                             tolerance="fit" activeStyleClass="slotActive" datasource="doneTasks"
                                             scope="completed" onDrop="handleDrop"/>

                                <p:dataGrid id="toDoTasks" value="#{taskboardBean.toDoTasks}" var="item" columns="3">
                                    <p:column>
                                        <h:panelGroup id="tasks" styleClass="postit" >
                                            <h:outputText value="#{item.description}"/>
                                            <br/><br/>
                                            <h:outputText value="#{msgBundle.effort}: #{item.estimatedEffort}"/>
                                        </h:panelGroup>

                                        <p:draggable for="tasks" scope="#{item.status.description}" revert="true"/>
                                    </p:column>
                                </p:dataGrid>

                            </p:outputPanel>
                        </div>

                        <div class="kanbanbox" align="center" >
                            <h3>
                                <h:outputText value="#{msgBundle.in_progress}" />
                            </h3>

                            <p:outputPanel id="doingPanel" styleClass="bigslot">
                                <p:droppable dropListener="#{taskboardBean.onDrop}"
                                            tolerance="fit" activeStyleClass="slotActive" datasource="toDoTasks"
                                            scope="pending" onDrop="handleDrop"/>

                                <p:dataGrid id="doingTasks" value="#{taskboardBean.doingTasks}" var="item" columns="3">
                                    <p:column>
                                        <h:panelGroup id="tasks" styleClass="postit" >
                                            <h:outputText value="#{item.description}"/>
                                            <br/><br/>
                                            <h:outputText value="#{msgBundle.effort}: #{item.estimatedEffort}"/>
                                        </h:panelGroup>

                                        <p:draggable for="tasks" scope="#{item.status.description}" revert="true"/>
                                    </p:column>
                                </p:dataGrid>
                            </p:outputPanel>

                        </div>

                        <div class="kanbanbox" align="center" >
                            <h3>
                                <h:outputText value="#{msgBundle.completed}" />
                            </h3>

                            <p:outputPanel id="donePanel" styleClass="bigslot">
                                <p:droppable dropListener="#{taskboardBean.onDrop}"
                                            tolerance="fit" activeStyleClass="slotActive"  datasource="doingTasks"
                                            scope="in_progress" onDrop="handleDrop"/>

                                <p:dataGrid id="doneTasks" value="#{taskboardBean.doneTasks}" var="item" columns="3">
                                    <p:column>
                                        <h:panelGroup id="tasks" styleClass="postit" >
                                            <h:outputText value="#{item.description}"/>
                                            <br/><br/>
                                            <h:outputText value="#{msgBundle.effort}: #{item.estimatedEffort}"/>
                                        </h:panelGroup>

                                        <p:draggable for="tasks" scope="#{item.status.description}" revert="true"/>
                                    </p:column>
                                </p:dataGrid>
                            </p:outputPanel>
                        </div>
                    </div>
                </h:form>
            </div>
        </div>
        <div id="container">
            <div id="footer">
                <div id="credits">Template based on another by <a href="http://www.bloganje.com">Bloganje</a>
                </div>
                <br />
            </div>
        </div>
    </f:view>
</h:body>
</html>
